<template>
  <div>
    <button @click="isShow=!isShow">显示/隐藏</button>
    <Transition name="jj"> 
        <h1 v-show="isShow" >你好啊</h1>
    </Transition>
  </div>
</template>

<script>
    export default {
        name:"Test",
        data() {
            return {
                isShow:true
            }
        },
    }
</script>

<style>
    h1{
        background-color: orange;
    }

    .jj-enter-active{
        animation: act 1s ;
    }

    .jj-leave-active{
        animation: act 1s reverse;
    }

    /* 动画 */
    @keyframes act {
        from{
            transform: translateX(-100%);
        }
        to{
            transform: translateX(0px);
        }
    }
</style>